package socket;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.Scanner;

public class SocketClient {
	public static void main(String[] args) {
		
		String s = "";
		String origem = "";
		Scanner teclado = new Scanner(System.in);
		
		try {
			Socket socket = new Socket("10.17.2.209", 4321);
			DataInputStream in = new DataInputStream (socket.getInputStream());
			DataOutputStream out = new DataOutputStream (socket.getOutputStream());

			while (!origem.equals("fim")) {
				origem = teclado.nextLine();
				out.writeUTF(origem);
				s = in.readUTF();
				//System.out.println("[CLIENTE] Enviou mensagem ao servidor!");
				System.out.println("[resposta]: "+ s);
			}
			
			in.close();
			out.close();
			socket.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

//10.202..19